﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
using Dude.MLS;
using Dude.Data.Meta;

namespace Serialization
{
    class Program
    {
        static void Main(string[] args)
        {
            DataModel dm = new DataModel();

            DatabaseInfo db = new DatabaseInfo();

            TableInfo tb = new TableInfo();
            tb.TableName = "table";
            tb.DBTableName = "dbtb";

            DataFieldInfo fi = new DataFieldInfo();
            fi.FieldName = "field1";
            fi.Description.Add("en", "Field 1 description");
            fi.Description.Add("cs", "Field 1 popis");
            Console.WriteLine(fi.Description);
            fi.DBFieldName = "field1";
            tb.Fields.Add(fi);

            fi = new DataFieldInfo();
            fi.FieldName = "field2";
            fi.DBFieldName = "field2";
            tb.Fields.Add(fi);

            db.Tables.Add(tb);
            db.Tables.Add(tb);

            dm.Databases.Add(db);

            dm.Save("table.xml");
            dm = DataModel.Load("table.xml");
            dm.Save("table2.xml");
        }
    }
}
